﻿<phone:PhoneApplicationPage 
    x:Class="Payton.WP7.Views.MainView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"
    xmlns:pi="clr-namespace:Microsoft.Practices.Prism.Interactivity;assembly=Microsoft.Practices.Prism.Interactivity"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    d:DataContext="{d:DesignData /SampleData/MainViewModelSampleData.xaml}"
    SupportedOrientations="PortraitOrLandscape" 
    shell:SystemTray.IsVisible="False"  Orientation="Portrait">
    <!--
<toolkit:TransitionService.NavigationInTransition>
            <toolkit:NavigationInTransition>
                <toolkit:NavigationInTransition.Backward>
                    <toolkit:TurnstileTransition Mode="BackwardIn"/>
                </toolkit:NavigationInTransition.Backward>
                <toolkit:NavigationInTransition.Forward>
                    <toolkit:TurnstileTransition Mode="ForwardIn"/>
                </toolkit:NavigationInTransition.Forward>
            </toolkit:NavigationInTransition>
        </toolkit:TransitionService.NavigationInTransition>
        <toolkit:TransitionService.NavigationOutTransition>
            <toolkit:NavigationOutTransition>
                <toolkit:NavigationOutTransition.Backward>
                    <toolkit:TurnstileTransition Mode="BackwardOut"/>
                </toolkit:NavigationOutTransition.Backward>
                <toolkit:NavigationOutTransition.Forward>
                    <toolkit:TurnstileTransition Mode="ForwardOut"/>
                </toolkit:NavigationOutTransition.Forward>
            </toolkit:NavigationOutTransition>
        </toolkit:TransitionService.NavigationOutTransition>
    LayoutRoot is the root grid where all page content is placed-->

    <Grid x:Name="LayoutRoot" Background="{StaticResource BackroundBrush}" >

        <!--Pivot Control-->
        <Rectangle Visibility="{Binding HasBindedAccount,Converter={StaticResource BoolToVisibilityConverter}}" Style="{StaticResource MainViewSpliterStyle}"/>
        <!--<Border Grid.RowSpan="2" Margin="0,120,0,0" Visibility="{Binding HasBindedAccount,Converter={StaticResource BoolToVisibilityConverter}}" Background="{StaticResource BorderContainerBrush1}" BorderBrush="#FF413B3B"/>  -->
        <toolkit:PerformanceProgressBar x:Name="progressIndicator" IsIndeterminate="{Binding Loading}" HorizontalAlignment="Stretch" VerticalAlignment="Top"/>
        <controls:Pivot Title="{Binding WeiboPlusText, Source={StaticResource AppResx}}" Foreground="LightGray" SelectedIndex="{Binding PivotSelectedIndex,Mode=TwoWay}" ItemContainerStyle="{StaticResource PivotItemContainerStyle}"  Visibility="{Binding HasBindedAccount,Converter={StaticResource BoolToVisibilityConverter}}" >
            <!--Pivot item one -->
            <controls:PivotItem>
                <controls:PivotItem.Header>
                    <TextBlock Text="{Binding WhatsNewText, Source={StaticResource AppResx}}" VerticalAlignment="Bottom" FontSize="48" Margin="0,2,2,2"/>
                </controls:PivotItem.Header>
                <Grid Margin="-10,0,0,0">
                    <ListBox x:Name="ContentGrid"  ItemsPanel="{StaticResource ItemsPanelTemplate1}" SelectionChanged="ContentGrid_SelectionChanged" ItemsSource="{Binding Items}"  ItemTemplate="{StaticResource StatusListDataTemplate}" ItemContainerStyle="{StaticResource ListBoxItemStyle2}"/>
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem>
                <controls:PivotItem.Header>
                    <TextBlock Text="{Binding MineText, Source={StaticResource AppResx}}" FontSize="48" Margin="2" VerticalAlignment="Bottom"/>
                </controls:PivotItem.Header>
                <Grid Margin="-10,0,0,0">
                    <ListBox x:Name="mentionList" ItemsSource="{Binding Mentions}" SelectionChanged="ContentGrid_SelectionChanged"   ItemsPanel="{StaticResource ItemsPanelTemplate1}" ItemTemplate="{StaticResource StatusListDataTemplate}" ItemContainerStyle="{StaticResource ListBoxItemStyle2}"/>
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem>
                <controls:PivotItem.Header>
                    <!--<TextBlock Text="{Binding CommentOnMineText, Source={StaticResource AppResx}}" FontSize="48" Margin="0"/>-->
                    <TextBlock Text="{Binding CommentOnMineText, Source={StaticResource AppResx}}" FontSize="48" Margin="2" VerticalAlignment="Bottom"/>
                </controls:PivotItem.Header>
                <Grid Margin="-10,0,0,0">
                    <ListBox x:Name="commentsToMeList" SelectionChanged="CommentList_SelectionChanged"  ItemsSource="{Binding CommentsToMe}"  ItemsPanel="{StaticResource ItemsPanelTemplate1}" ItemTemplate="{StaticResource StatusListDataTemplate}" ItemContainerStyle="{StaticResource ListBoxItemStyle2}"/>
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem>
                <controls:PivotItem.Header>
                    <TextBlock Text="{Binding MyCommentText, Source={StaticResource AppResx}}" FontSize="48" Margin="2"/>
                    <!--<StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding MyCommentText, Source={StaticResource AppResx}}" FontSize="56" Margin="2,0,4,4" VerticalAlignment="Bottom"/>
                        <Image Height="60" Width="78" Source="../Images/standard/commentbyme.png" VerticalAlignment="Bottom" />
                    </StackPanel>-->
                </controls:PivotItem.Header>
                <Grid Margin="-10,0,0,0">
                    <ListBox x:Name="commentsByMeList" SelectionChanged="CommentList_SelectionChanged" ItemsSource="{Binding CommentsByMe}"  ItemsPanel="{StaticResource ItemsPanelTemplate1}" ItemTemplate="{StaticResource StatusListDataTemplate}" ItemContainerStyle="{StaticResource ListBoxItemStyle2}"/>
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem>
                <controls:PivotItem.Header>
                    <TextBlock Text="{Binding SearchTopicText, Source={StaticResource AppResx}}" FontSize="48" Margin="0"/>
                    <!--<StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding SearchTopicText, Source={StaticResource AppResx}}" FontSize="48" Margin="2" VerticalAlignment="Bottom"/>
                        <Image  Height="48" Width="60" Source="../Images/standard/magnifyingglass.png" VerticalAlignment="Center" />
                    </StackPanel>-->
                </controls:PivotItem.Header>
                <Grid Margin="-10,0,0,0">
                    <StackPanel Height="100" VerticalAlignment="Top" HorizontalAlignment="Stretch" Orientation="Horizontal">
                        <TextBox Height="78" Name="tbSearchWord" Style="{StaticResource TextBoxStyle1}" HorizontalAlignment="Left"  Text="{Binding SearchKeyword,Mode=TwoWay}" Width="340" Margin="10,0,0,0"></TextBox>
                    </StackPanel>
                    <ListBox x:Name="searchList" ItemsSource="{Binding SearchRsults}" SelectionChanged="ContentGrid_SelectionChanged"  ItemsPanel="{StaticResource ItemsPanelTemplate1}" ItemTemplate="{StaticResource StatusListDataTemplate}" ItemContainerStyle="{StaticResource ListBoxItemStyle2}" VerticalAlignment="Top" Margin="0,100,0,0"/>
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem>
                <controls:PivotItem.Header>
                    <TextBlock Text="{Binding NewStatusText, Source={StaticResource AppResx}}" FontSize="48" Margin="0"/>
                    <!--<StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding NewStatusText, Source={StaticResource AppResx}}" FontSize="48" Margin="2" VerticalAlignment="Bottom"/>
                        <Image Height="48" Width="60" Source="../Images/standard/pencilangled.png" />
                    </StackPanel>-->
                </controls:PivotItem.Header>
                <Grid Margin="-10,0,0,0">
                    <TextBox Style="{StaticResource TextBoxStyle1}" Margin="10,0,0,0" AcceptsReturn="True"  Text="{Binding StatusToUpdate,Mode=TwoWay}" Name="tbSend" TextWrapping="Wrap" Height="110" VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
                    <TextBlock Visibility="Collapsed" Text="{Binding RemainderTextToSend}" Margin="0,70,0,0" HorizontalAlignment="Right" VerticalAlignment="Top" />
                    <ListBox VerticalAlignment="Top" ItemsSource="{Binding BindedAccounts}" Margin="10,110,0,10" ScrollViewer.ManipulationMode="System" ScrollViewer.VerticalScrollBarVisibility="Disabled" Padding="-2"  ScrollViewer.HorizontalScrollBarVisibility="Auto" ItemTemplate="{StaticResource DestinationSettingListItemTemplate}">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Horizontal"/>
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                    </ListBox>

                    <Image Margin="20,200,20,80" HorizontalAlignment="Left" Source="{Binding ImageToSend}"></Image>
                </Grid>
            </controls:PivotItem>
            <!--Pivot item two-->
        </controls:Pivot>
        <Grid Visibility="{Binding HasBindedAccount,Converter={StaticResource ReverseBoolToVisibilityConverter}}"   HorizontalAlignment="Stretch" Margin="60,140,60,20" VerticalAlignment="Top" x:Name="addNewGrid">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" MinHeight="100"/>
                <RowDefinition/>
                <RowDefinition Height="0*"/>
            </Grid.RowDefinitions>
            <Border Grid.Row="0" Grid.RowSpan="2" Style="{StaticResource NewAccountGridBorderStyle}" d:LayoutOverrides="GridBox"/>
         
            <toolkit:ListPicker Grid.Column="1" Margin="20,50,20,0" ItemTemplate="{StaticResource ProviderPickerItemTemplate}" ExpansionMode="ExpansionAllowed" Style="{StaticResource ListPickerStyle}" SelectedItem="{Binding SelectedProvider,Mode=TwoWay}" ItemsSource="{Binding SupportedProviders}" d:LayoutOverrides="Height">
            </toolkit:ListPicker>
            <TextBlock Margin="30,10,30,0" Text="{Binding BindToANewAccountText, Source={StaticResource AppResx}}" FontFamily="{StaticResource PhoneFontFamilyNormal}"  TextWrapping="Wrap" Foreground="{StaticResource PhoneAccentBrush}" Height="33" VerticalAlignment="Top"/>
            <StackPanel Grid.Row="1" Grid.Column="1">
                <TextBlock Margin="20,20" Grid.Row="1" Grid.Column="1" Foreground="LightGray"  FontSize="{StaticResource PhoneFontSizeSmall}" TextWrapping="Wrap" Text="{Binding BindToANewAccountInfoText, Source={StaticResource AppResx}}"/>
                <Button ClickMode="Release" HorizontalAlignment="Right" Foreground="{StaticResource PhoneAccentBrush}" Content="{Binding AuthorizeText, Source={StaticResource AppResx}}"  Padding="12,2"  Name="AuthorizeButton" BorderThickness="0" Command="{Binding Authorize}"/>
            </StackPanel>
        </Grid>
        <!--<Grid Background="Black" Opacity=".5" Visibility="{Binding ShowQuickSetting,Converter={StaticResource BoolToVisibilityConverter}}" >

        </Grid>-->
    </Grid>

    <!--Sample code showing usage of ApplicationBar
                     <shell:ApplicationBarMenuItem Click="search_Click" Text="搜索话题" />-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Opacity=".5">
            <shell:ApplicationBar.MenuItems>
                <!--
                shell:ApplicationBarMenuItem Click="account_management_Click"  Text="账号管理" />
                <shell:ApplicationBarMenuItem Click="settingItem_Click" Text="用户设置" />
                <shell:ApplicationBarMenuItem Click="aboutItem_Click" Text="关于我们" />
                -->
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>
